package com.tuanzi.loan.business.service.family.impl;

import com.tuanzi.loan.business.entity.family.LoanChannelNdInfo;
import com.tuanzi.loan.business.repository.family.LoanChannelNdInfoRepository;
import com.tuanzi.loan.business.service.family.LoanChannelNdInfoService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.repository.JPAAuditRepository;
import com.tuanzi.loan.core.service.BaseAuditServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.family.LoanChannelNdInfoRequest;
import com.tuanzi.loan.vo.response.family.LoanChannelNdInfoResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * User: liangZongXi
 * Create time: 16:01 2019/8/6
 * Description:
 */
@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class LoanChannelNdInfoServiceImpl extends BaseAuditServiceImpl<LoanChannelNdInfo, Long> implements LoanChannelNdInfoService {

    @Autowired
    private LoanChannelNdInfoRepository loanChannelNdInfoRepository;

    @Override
    public Page<LoanChannelNdInfoResponse> list(PageSearcher<LoanChannelNdInfoRequest> pageSearcher) {
        return loanChannelNdInfoRepository.list(pageSearcher.getSearchCondition(), pageSearcher.getPageable());
    }

    @Override
    protected JPAAuditRepository<LoanChannelNdInfo, Long> getRepository() {
        return loanChannelNdInfoRepository;
    }

    @Override
    public List<String> findDistinctChannelNd() {
        return loanChannelNdInfoRepository.findDistinctChannelNd();
    }
}
